<?php
//---------------------------------------------------------------------------------------------------
    require_once('../config.inc.php');

    require_once($config['app_dir'] . '/classes/StockMailers.class.php');

//-----------------------------------------------------------------------------------------------

        $tradeID = intval($argv[1]);
        $endTime = intval($argv[3]);
		$system = intval($argv[4]);
//        $beginTime = intval($argv[2]) - 60*60*24*7;
//        $beginTime = $endTime - 60*60*24*13; //show 14 days
        $beginTime = $endTime - 60*60*24*8; //show 9 days - 2 days of weekend

	$start = date('Y-m-d',$beginTime);
	$finish = date('Y-m-d',$endTime);

	echo $tradeID. ' ';
	echo $start.' ';
	echo $finish." \n";

	try {
       	$StockMailer = new objStockParamMailer($trade, 
			DateConvert::Date('Y-m-d', $start), 
			DateConvert::Date('Y-m-d', $finish), -1, $system);
	   	$StockMailer->Send();
	} catch(exception $e) {
		die('Error: '.$e->getMessage());
	}
//---------------------------------------------------------------------------------------------------
?>